package com.party.core.dao.read.coupon;

import com.party.common.paging.Page;
import com.party.core.dao.read.BaseReadDao;
import com.party.core.model.coupon.CouponCode;
import com.party.core.model.coupon.CouponCodeOutput;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author：yifeng
 * @description： 核销码
 * @date：Created in  2017/11/27 上午 9:58
 **/
@Repository
public interface CouponCodeReadDao extends BaseReadDao<CouponCode> {
    /**
     * web列表
     *
     * @param couponCode
     * @param params
     * @param page
     * @return
     */
    List<CouponCodeOutput> webListPage(@Param(value = "couponCode") CouponCode couponCode, @Param(value = "params") Map<String, Object> params, Page page);

    /**
     * 获取核销码库存
     *
     * @param couponId 券id
     * @return
     */
    Long getCountByCoupon(String couponId);

    /**
     * 获取没有领取的核销码
     *
     * @param giftId 礼包id
     * @return
     */
    CouponCode randomNotUsed(String giftId);
}
